package com.audaque.springboot.foshanupload.web.mbdemo.page;
import java.util.List;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

@Setter@Getter@ToString
public class PageResult {

	private List<?> listData;
	private Integer currentPage;
	private Integer totalCount;
	private Integer pageSize;

	private Integer totalPage;
	private Integer prevPage;
	private Integer nextPage;

	public PageResult(List<?> listData, Integer currentPage, Integer totalCount, Integer pageSize) {
		this.listData = listData;
		this.currentPage = currentPage;
		this.totalCount = totalCount;
		this.pageSize = pageSize;
		this.totalPage = totalCount % pageSize == 0 ? totalCount / pageSize : totalCount / pageSize + 1;
		this.prevPage = currentPage - 1 > 0 ? currentPage - 1 : 1;
		this.nextPage = currentPage + 1 <= totalPage ? currentPage + 1 : totalPage;
	}

}
